package com.cxyd.modules.wms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cxyd.common.service.impl.CrudServiceImpl;
import com.cxyd.common.utils.ConvertUtils;
import com.cxyd.modules.wms.dao.InterfaceSapDao;
import com.cxyd.modules.wms.dto.InterfaceSapDTO;
import com.cxyd.modules.wms.entity.InterfaceSapEntity;
import com.cxyd.modules.wms.service.InterfaceSapService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class InterfaceSapServiceImpl extends CrudServiceImpl<InterfaceSapDao, InterfaceSapEntity, InterfaceSapDTO> implements InterfaceSapService {
    @Override
    public QueryWrapper<InterfaceSapEntity> getWrapper(Map<String, Object> params) {
        return null;
    }

    @Override
    public InterfaceSapDTO selectByDeliverNo(String deliverNo) {
        if (StringUtils.isBlank(deliverNo)) {
            return null;
        }
        final InterfaceSapEntity entity = baseDao.selectOne(new QueryWrapper<InterfaceSapEntity>().eq("deliver_no", deliverNo));

        return ConvertUtils.sourceToTarget(entity, InterfaceSapDTO.class);
    }
}
